package cn.opopopo.design_pattern_learn.行为型.visitor;

// 3. 打印预览访问者
class PrintPreviewVisitor implements DocumentElementVisitor {
    @Override
    public void visit(TextElement text) {
        System.out.println("打印文本: " + text.getContent());
    }

    @Override
    public void visit(ImageElement image) {
        System.out.println("打印图片: " + image.getImageUrl() + " (" + image.getSize() + "KB)");
    }

    @Override
    public void visit(TableElement table) {
        System.out.println("打印表格: " + table.getRows() + "行 x " + table.getCols() + "列");
    }
}